<?php

use doumiaoduo\layer\LayerConfirmWidget;
use doumiaoduo\layer\LayerIframeWidget;
use zhtfrontend\modules\customermanage\components\services\Cmutil;
use yii\widgets\ActiveForm;

LayerConfirmWidget::widget();
LayerIframeWidget::widget();
?>

<div id="search-area" class="yx-bgf7f7f7 yx-radius5 yx-function2 yx-pr0" style="margin-bottom:15px;">
    <?php $form = ActiveForm::begin(['enableAjaxValidation' => true, 'enableClientValidation' => false, 'options' => ['class' => 'form-validate']]); ?>
    <?= $form->field(
        $model,
        'salesman_id',
        ['template' => '{input}{error}{hint}']
    )->widget(
        \kartik\select2\Select2::className(),
        [
            'data' => yii\helpers\ArrayHelper::map(\zhtfrontend\models\datas\Admin::find()->where(['status' => 1])->andWhere(['in', 'role', ['sales_director','sales_specialist']])->all(), 'id', 'name'),
            'options' => ['placeholder' => '请选择负责人']
        ]
    )
    ?>
</div>
    <div class="docs-main">
        <table id="tablesaw" class="tablesaw table yx-table1 yx-table3 table-striped with-check"
               data-tablesaw-mode="swipe" data-tablesaw-minimap>
            <thead>
            <tr class="yx-bgd2f6ec">
                <th scope="listorder_input">
                    <?= \Yii::t('zhtfrontend', '选择'); ?>
                </th>
                <th><?= \Yii::t('zhtfrontend', 'ID'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '姓名'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '性别'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '手机号码'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '意向分类'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '客户状态'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '市场负责人'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '销售负责人'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '加入时间'); ?></th>
                <th><?= \Yii::t('zhtfrontend', '来源'); ?></th>
            </tr>
            </thead>
            <?php if ($data): ?>
                <?php foreach ($data as $item): ?>
                    <tr data-id="<?= $item['id'] ?>">
                        <td><?= \yii\helpers\Html::checkbox('ids[]', false, ['value' => $item['id']]) ?></td>
                        <td><?= $item['id'] ?></td>
                        <td><?= $item['name'] ?></td>
                        <td><?= ($item['sex'] == 0) ? '男' : '女' ?></td>
                        <td><?= $item['mobile'] ?></td>
                        <td><?= Cmutil::getCategory($item['category_id']) ?></td>
                        <td><?= Cmutil::getStatus($item['status']) ?></td>
                        <td><?= Cmutil::getAdmin($item['admin_id']) ?></td>
                        <td><?= Cmutil::getAdmin($item['salesman_id']) ?></td>
                        <td><?= \Yii::$app->formatter->asDate($item['created_at'], 'yyyy-MM-dd h:i:s') ?></td>
                        <td><?= Cmutil::getSource($item['source']) ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php endif; ?>
        </table>
    </div>
    <div class="yx-submit-box" style="display: none">
        <?= \yii\helpers\Html::submitButton('提交', ['class' => "button yx-submit", 'id' => 'dosubmit']) ?>
    </div>
<?php \yii\widgets\ActiveForm::end(); ?>


